/* 
    插入排序
*/
var insertSort = function (arr) {
    for (let i = 0; i < arr.length; i++) {
        for (let j = i; j > 0; j--) {
            if (arr[j - 1] > arr[j]) {
                let temp = arr[j];
                arr[j] = arr[j - 1];
                arr[j - 1] = temp;
            } else {
                break;
            }
        }
    }
    return arr;
};
// console.log(insertSort instanceof Function);
// let arr = [12, 45, 45, 78, 721, 45, 12, 4544, 54, 45, 45, 445, 454, 5, 1212, 45, 10, 1, 1];
// let res = insertSort(arr);
// console.log(res);
module.exports = {
    insertSort
};
